//
// Created by yeongguo(郭青云) on 2019-12-11.
//

#ifndef DECODER_MP3_ENCODE_H
#define DECODER_MP3_ENCODE_H

#endif //DECODER_MP3_ENCODE_H

#include <stdio.h>
#include "lame/lame.h"

#ifndef MYAPPLICATION_MP3_ENCODER_H
#define MYAPPLICATION_MP3_ENCODER_H
#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
    unsigned char *data;
    int length;
} EncodeData;

class Mp3Encoder {
private:
    lame_t lameClient;
    int tailData = 0x01;
    const int dataLength = 6400;

public:
    Mp3Encoder();

    ~Mp3Encoder();

    int lint(int sampleRate,
             int channels,
             int bitRate,
             int quality);

    EncodeData *encode(
            const short *buffer,
            long size
    );

    int Destroy();
};

#ifdef __cplusplus
}
#endif
#endif